<template>
    <div class="container-content">
        <el-row>
            <el-col :span="24">
                <h3 class="panel-title">编辑投标结果</h3>
            </el-col>
        </el-row>
        <el-divider class="divider"></el-divider>
        <el-form
            ref="formRef"
            :model="formObject"
            label-width="100px"
            label-position="left"
            class="mt20"
        >
            <el-row :gutter="20">
                <el-col :span="24">
                    <el-form-item label="标书">
                        <el-input v-model="formObject.bidId"></el-input>
                    </el-form-item>
                </el-col>
                <el-col :span="24">
                    <el-form-item label="投标信息">
                        <el-input v-model="formObject.tenderId"></el-input>
                    </el-form-item>
                </el-col>
                <el-col :span="24">
                    <el-form-item label="投标总结">
                        <el-input v-model="formObject.tenderRemarks"></el-input>
                    </el-form-item>
                </el-col>

                <el-col :span="24">
                    <el-form-item label="中标单位">
                        <el-input v-model="formObject.winBidCompany"></el-input>
                    </el-form-item>
                </el-col>
                <el-col :span="24">
                    <el-form-item label="中标金额">
                        <el-input
                            v-model="formObject.winBidMoney"
                            @change="changeMoney"
                        ></el-input>
                    </el-form-item>
                </el-col>
                <el-col :span="24">
                    <el-form-item label="中标金额大写">
                        <el-input v-model="formObject.winBidMoneyCh"></el-input>
                    </el-form-item>
                </el-col>
                <el-col :span="24">
                    <el-form-item label="是否中标">
                        <!-- <el-input v-model="formObject.isWinBid"></el-input> -->
                        <el-radio
                            v-model="formObject.isWinBid"
                            :label="1"
                            border
                            >是</el-radio
                        >
                        <el-radio
                            v-model="formObject.isWinBid"
                            :label="2"
                            border
                            >否</el-radio
                        >
                    </el-form-item>
                </el-col>
            </el-row>
            <!-- <el-row :gutter="20">
                <el-col :span="24">
                    <el-form-item label="备注">
                        <el-input
                            v-model="formObject.remarks"
                            type="textarea"
                        ></el-input>
                    </el-form-item>
                </el-col>
            </el-row> -->
            <el-form-item label-width="0px">
                <el-button type="primary" @click="onSubmit">保存</el-button>
                <el-button>取消</el-button>
            </el-form-item>
        </el-form>
    </div>
</template>
<script>
import { convertToRMB } from "@/utils/utils";
import { getDetailResultList, editResultList } from "@/api/system/tender";
export default {
    data() {
        return {
            formObject: {
                bidId: "",
                buyTime: "",
                changeTime: "",
                createTime: "",
                customerId: "",
                id: "",

                tenderId: "",
                token: "",
                userId: "",
                isWinBid: "",
                winBidMoney: "",
                winBidCompany: "",
                winBidMoneyCh: "",
                tenderRemarks: "",
            },
        };
    },
    methods: {
        onSubmit() {
            editResultList(this.formObject).then((res) => {
                if (res.code === 200) {
                    this.$message({
                        message: "修改成功！",
                        type: "success",
                    });
                    this.$router.push({ path: "/Tender/Result" });
                }
            });
        },
        changeMoney() {
            this.formObject.winBidMoneyCh = convertToRMB(
                this.formObject.winBidMoney * 1
            );
        },
        getData(id) {
            getDetailResultList(id).then((res) => {
                if (res.code === 200) {
                    this.formObject = res.data;
                }
            });
        },
    },
    created() {
        this.getData(this.$route.query.id);
    },
};
</script>
<style lang="scss" scoped>
.divider {
    margin: 0;
}
</style>
